package com.wang.hw.hw2;

public class Army {
    private Weapon[] weapons;

    public Army() {
    }

    public Army(int size) {
        weapons = new Weapon[size];
    }

    public void addWeapon(Weapon weapon){
        for (int i = 0; i < weapons.length; i++) {
            if (weapons[i] == null){
                weapons[i] = weapon;
                break;
            }
        }
    }

    public void attackAll(){
        for (Weapon weapon : weapons) {
            weapon.attack();
        }
    }

    public void moveAll(){
        for (Weapon weapon : weapons) {
            weapon.move();
        }
    }
}
